package com.baykalcakici.cafepicker.picker;

import org.joda.time.DateTime;

import com.google.common.base.Preconditions;

public class CafeHistoryItem implements Comparable<CafeHistoryItem> {
  public String name;
  public DateTime dateTime;

  public CafeHistoryItem(String[] row) {
    Preconditions.checkNotNull(row);
    name = row[0];
    dateTime = new DateTime(row[1]);
  }

  @Override
  public int compareTo(CafeHistoryItem that) {
    // Sort reverse order (latest visited cafe first).
    return that.dateTime.compareTo(this.dateTime);
  }
}
